<!DOCTYPE html>
<html>
<head>
    <!--需要改-->
    <base href="http://localhost/curriculumDesign/cilentservicer/">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Language" content="zh-CN">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CS - Center</title>
    <!-- <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css"
          rel="stylesheet">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/vue.js"></script>
    <script src="js/vue-resource.js"></script>

</head>
<body>
<div style="margin-top: 25px;"></div>
<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">测试区 - 客服中心</h3>
        </div>
    </div>
    <div class="panel-body">
        <div id="login">
            <input v-model="loginUid" placeholder="loginUid">
            <button class="btn btn-default" @click="login()">Submit</button>
            <label>当前User：{{uid}}</label>
        </div>

        <script>
            var vm = new Vue({
                el: '#login',
                data: {
                    loginUid: "10011",
                    uid: null
                },
                methods: {
                    login: function () {
                        this.$http.get("login", {params: {uid: this.loginUid}}).then(function (value) {
                            alert("ok")
                        })
                    },
                    getUid: function () {
                        this.$http.get("uid").then(function (value) {
                            this.uid = value.body
                        })
                    }
                }
            })
            setInterval(vm.getUid, 2000);
        </script>
    </div>
</div>

<!--操作区-->
<div id="funcBox" class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">Panel title</h3>
        </div>
        <div class="panel-body">
            <button @click="updateNewRequestList()" type="button" class="btn btn-info">刷新未接受的请求</button>
            <button @click="updateChatingList()" type="button" class="btn btn-info">刷新正在通话的会话</button>
        </div>
    </div>
</div>

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客服中心 - 所有客服</h3>
        </div>
        <div class="panel-body">
            <div id="servicerListTable" class="table-responsive" style="margin: 6px 0 0 0;">
                <!-- 属性行 -->
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>
                            <div class="th-inner">编号</div>
                        </th>
                        <th>
                            <div class="th-inner">称呼</div>
                        </th>
                        <th>
                            <div class="th-inner">状态</div>
                        </th>
                        <th>
                            <div class="th-inner ">评分</div>
                        </th>
                    </tr>
                    </thead>

                    <tbody>
                    <div>
                        <tr v-for="servicer in servicerList" :key="servicer.uid">
                            <td>{{servicer.uid}}</td>
                            <td>{{servicer.name}}</td>
                            <td>{{servicer.status}}</td>
                            <td>{{servicer.divScore}}</td>
                        </tr>
                    </div>
                    <div>
                        <!--<tr v-for="user in userList" :key="user.id">-->
                        <!--<td>{{user.id}}</td>-->
                        <!--<td><a @click="showFrom($event, user.id)" href="javascript:void(0)">{{user.name}}</td>-->
                        <!--<td><a @click="showFrom($event, user.id)" href="javascript:void(0)">{{new-->
                        <!--Date(user.birthday).getFullYear() + '-' + (new Date(user.birthday).getMonth() + 1) + '-'-->
                        <!--+ new-->
                        <!--Date(user.birthday).getDate()}}</a></td>-->
                        <!--<td><a @click="showFrom($event, user.id)" href="javascript:void(0)">{{user.addr}}</a></td>-->
                        <!--<td>-->
                        <!--<button disabled="disabled" type="button" class="btn btn-danger"-->
                        <!--@click="deleteThisUser($event)">删除-->
                        <!--</button>-->
                        <!--</td>-->
                        <!--</tr>-->
                    </div>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!--newRequestList-->
    <div id="newRequestListTable" class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客户中心 - 所有未接入的会话</h3>
        </div>
        <div class="panel-body">
            <div class="table-responsive" style="margin: 6px 0 0 0;">
                <!-- 属性行 -->
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>
                            <div class="th-inner">cuser</div>
                        </th>
                        <th>
                            <div class="th-inner">beginTime</div>
                        </th>
                        <th>
                            <div class="th-inner">status</div>
                        </th>
                    </tr>
                    </thead>

                    <tbody>
                    <div>
                        <tr v-for="newRequest in newRequestList" :key="newRequest.cuserUid">
                            <td>{{newRequest.cuserUid}}</td>
                            <td>{{newRequest.beginTime}}</td>
                            <td>{{newRequest.status}}</td>
                        </tr>
                    </div>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div id="chatingListTable" class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客户中心 - 所有正在通话的会话</h3>
        </div>
        <div class="panel-body">
            <div class="table-responsive" style="margin: 6px 0 0 0;">
                <!-- 属性行 -->
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>
                            <div class="th-inner">用户</div>
                        </th>
                        <th>
                            <div class="th-inner">客服</div>
                        </th>
                        <th>
                            <div class="th-inner">状态</div>
                        </th>
                        <th>
                            <div class="th-inner">开始时间</div>
                        </th>
                        <th>
                            <div class="th-inner">opr</div>
                        </th>
                    </tr>
                    </thead>

                    <tbody>
                    <div>
                        <tr v-for="chat in chatingList" :key="chat.cuserUid">
                            <td>{{chat.cuserUid}}</td>
                            <td>{{chat.suserUid}}</td>
                            <td>{{chat.status}}</td>
                            <td>{{chat.beginTime}}</td>
                            <td>
                                <button @click="lokeChat(chat.cuserUid)" type="button" class="btn btn-success">
                                    窥屏
                                </button>
                            </td>
                        </tr>
                    </div>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<div class="container">
    <!--监控聊天窗口-->
    <div id="oneChat" class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客户中心 - 聊天记录 ： {{uid}} </h3>
        </div>
        <div class="panel-body">
            <!--聊天记录窗口-->
            <div class="table-responsive" style="margin: 6px 0 0 0;">
                <!-- 属性行 -->
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>
                            <div class="th-inner">value</div>
                        </th>
                        <th>
                            <div class="th-inner">time</div>
                        </th>
                        <th>
                            <div class="th-inner">type</div>
                        </th>
                    </tr>
                    </thead>

                    <tbody>
                    <div>
                        <tr v-for="msg in msgList" :key="msg.time">
                            <td>{{msg.value}}</td>
                            <td>{{msg.time}}</td>
                            <td>{{msg.type}}</td>
                        </tr>
                    </div>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>


<script src="js/center.js"></script>
</body>
</html>